﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.IoTManagement;

namespace Digitalmes.Model.IoTManagement
{
    /// <summary>
    /// 设备
    /// </summary>
	[Table("MeterDevice")]

    [Display(Name = "_Model.MeterDevice")]
    public class MeterDevice : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._MeterDevice._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._MeterDevice._DeviceCode")]
        [Comment("设备编号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string DeviceCode { get; set; }
        [Display(Name = "_Model._MeterDevice._DeviceName")]
        [Comment("设备名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string DeviceName { get; set; }
        [Display(Name = "_Model._MeterDevice._DeviceType")]
        [Comment("设备类型")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public MeterDeviceTypeEnum? DeviceType { get; set; }
        [Display(Name = "_Model._MeterDevice._Location")]
        [Comment("安装位置")]
        public string Location { get; set; }
        [Display(Name = "_Model._MeterDevice._Area")]
        [Comment("所属区域")]
        public string Area { get; set; }
        [Display(Name = "_Model._MeterDevice._Manufacturer")]
        [Comment("制造商")]
        public string Manufacturer { get; set; }
        [Display(Name = "_Model._MeterDevice._InstallDate")]
        [Comment("安装日期")]
        public DateTime? InstallDate { get; set; }
        [Display(Name = "_Model._MeterDevice._CommAddress")]
        [Comment("通讯地址")]
        public string CommAddress { get; set; }
        [Display(Name = "_Model._MeterDevice._CommProtocol")]
        [Comment("通讯协议")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DriverTypeEnum? CommProtocol { get; set; }
        [Display(Name = "_Model._MeterDevice._Status")]
        [Comment("状态")]
        public EquipStatusEnum? Status { get; set; }
        [Display(Name = "_Model._MeterDevice._Remark")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._MeterParameter._Device")]
        [InverseProperty("Device")]
        public List<MeterParameter> MeterParameter_Device { get; set; }
        [Display(Name = "_Model._MeterDataRecord._Device")]
        [InverseProperty("Device")]
        public List<MeterDataRecord> MeterDataRecord_Device { get; set; }
        [Display(Name = "_Model._CollectTask._Device")]
        [InverseProperty("Device")]
        public List<CollectTask> CollectTask_Device { get; set; }
        [Display(Name = "_Model._MeterDevice._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
